package com.iee.patterns.example.state.login;

/**
 * 具体状态2- 未登陆状态
 */
public class UnLoginState extends UserState {
    @Override
    public void favourite() {
        this.switchToLogin();
        this.appContext.getState().favourite();
    }

    @Override
    public void comment(String comment) {
        this.switchToLogin();
        this.appContext.getState().comment(comment);
    }

    // 用户切换状态
    private void switchToLogin(){
        System.out.println("切换状态，跳转到登陆页面");
        // 切换状态
        this.appContext.setState(this.appContext.SATE_LOGIN);
    }
}
